<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>layout 后台大布局 - Layui</title>
<link rel="stylesheet" href="/layui-v2.0.1/layui/css/layui.css">
<link rel="stylesheet" href="/css/admin.css">

</head>
<body>
  <form action="dochange" method="post" style="width:500px;margin-top: 20px;margin-left: 50px">
   <input type="hidden" name="id" value="<?php echo $res['id'];?>">
    <div class="layui-form-item">
      <label class="layui-form-label">opinID</label>
      <div class="layui-input-inline">
        <input type="text" name="openid" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input" value="<?php echo $res['openid']?>">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">昵称</label>
      <div class="layui-input-inline">
        <input type="text" name="nickname" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input" value="<?php echo $res['nickname']?>">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">真实姓名</label>
      <div class="layui-input-inline">
        <input type="text" name="realname" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input" value="<?php echo $res['realname']?>">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">性别</label>
      <div class="layui-input-inline">
        <input type="text" name="sex" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input" value="<?php echo $res['sex']?>">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">省份</label>
      <div class="layui-input-inline">
        <input type="text" name="province" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input" value="<?php echo $res['province']?>">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">城市</label>
      <div class="layui-input-inline">
        <input type="text" name="city" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input" value="<?php echo $res['city']?>">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">手机号</label>
      <div class="layui-input-inline">
        <input type="text" name="phone" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input" value="<?php echo $res['phone']?>">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">出生日期</label>
      <div class="layui-input-inline">
        <input type="text" name="birthday" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input" value="<?php echo $res['birthday']?>">
      </div>
    </div>
    <div class="layui-form-item">
      <div class="layui-input-block">
        <button class="layui-btn" lay-submit="" lay-filter="demo1">确认修改</button>
      </div>
    </div>
 
  </form>




<script src="/layui-v2.0.1/layui/layui.js"></script>

<script>
layui.use(['table','jquery'],function(){
  var table = layui.table;
  var $ = layui.jquery;
  table.on('tool(test)', function(obj){ //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
  var data = obj.data; //获得当前行数据
  var layEvent = obj.event; //获得 lay-event 对应的值
  var tr = obj.tr; //获得当前行 tr 的DOM对象
  var id=data['id'];

  if(layEvent === 'detail'){ //查看
    //do somehing
    layer.open({
    type: 2,
    title: '详情',
    maxmin: true,
    shadeClose: true, //点击遮罩关闭层
    area : ['800px' , '520px'],
    shade: [0.65],
    content: 'detail?id='+id,
    // end : function(){
    //   location.reload();
    // }
    })


  } else if(layEvent === 'del'){ //删除
    layer.confirm('真的删除行么', function(index){
      obj.del(); //删除对应行（tr）的DOM结构
      layer.close(index);
        $.ajax({
        url:'dele',
        type:'post',
        data:{'id':id},
        dataType:'json',
        success:function(d){
          if(d.code==200){
            layer.msg(d.msg, {
            icon: 1,
            time: 1000 //1秒关闭（如果不配置，默认是3秒）
          });  
          }else{
            layer.msg(d.msg);
          }
         }
        })

      //向服务端发送删除指令
    });
  } else if(layEvent === 'edit'){ //编辑
    //do something
    layer.open({
    type: 2,
    title: '修改',
    maxmin: true,
    shadeClose: true, //点击遮罩关闭层
    area : ['800px' , '720px'],
    shade: [0.65],
    content: 'change?id='+id,
    end : function(){
      location.reload();
    }
    })
    
  }
});


});

</script>
</body>
</html>

